<%--
  Created by IntelliJ IDEA.
  User: w1057229265
  Date: 2021/5/30
  Time: 13:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <titlti>Title</titlti>
    <link rel="stylesheet" type="text/css" href="static/plugins/jquery-easyui-1.9.15/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="static/plugins/jquery-easyui-1.9.15/themes/icon.css">
    <script type="text/javascript" src="static/plugins/jquery-easyui-1.9.15/jquery.min.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui-1.9.15/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui-1.9.15/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="static/js/validate.js"></script>
    <script>
        $(function (){
            $('#dd').dialog({
                title: '注册用户',
                width: 400,
                height: 300,
                closed: false,
                cache: false,
                modal: true,
                buttons:[{
                text:'保存',
                iconCls:'icon-save',
                handler:function(){
                    $.messager.progress();	// display the progress bar
                    $('#ff').form('submit', {
                        url: 'ServletLogin?action=register',
                        onSubmit: function(){
                            var isValid = $(this).form('validate');
                            if (!isValid){
                                $.messager.progress('close');	// hide progress bar while the form is invalid
                            }
                            return isValid;	// return false will stop the form submission
                        },
                        success: function(data){
                            var data = eval('(' + data + ')'); // change the JSON string to javascript object
                            if (data.code == '200'){
                                $.messager.alert('提示',data.msg + '返回登录', 'info')
                                location.href="/head.jsp"
                            }
                            else {
                                $.messager.alert('提示',data.msg , 'warning')
                            }
                            $.messager.progress('close');	// hide progress bar while submit successfully
                        }
                    });

                }
            },{
                text:'退出',
                iconCls:'icon-back',
                handler:function(){
                    location.href = "/login.jsp"
                }
            }]
            });

        })
    </script>

</head>
<body style="background-image: url('static/images/a.jpg')">
<div id="dd">
    <form id="ff" method="post">
        <table cellpadding="5">
            <tr>
                <td>用户名ID:</td>
                <td><input class="easyui-validatebox" type="text" id="id" name="id" data-options="required:true"></input></td>
            </tr>
                <td>用户名:</td>
                <td><input class="easyui-validatebox" type="text" id="username" name="username" data-options="required:true"></input></td>
            </tr>
            <tr>
                <td>密码:</td>
                <td><input class="easyui-validatebox" type="password" id="password" name="password" data-options="required:true"></input></td>
            </tr>
            <tr>
                <td>密码确认:</td>
                <td><input class="easyui-validatebox" type="text"  id="passwordcopy" name="passwordcopy" data-options="required:true "validType="equals['#password']"></input></td>
            </tr>
            <tr>
                <td>电话:</td>
                <td><input class="easyui-validatebox" type="text" id="phonenum"  name="phonenum" validType="telephone"></input></td>
            </tr>

        </table>
    </form>
</div>
</body>
</html>
